////////////////////////////////////////////page_carDetails//////////////////////
$(document).on("pageInit", "#page_carDetails", function(e, pageId, $page) {
    my.givetitle('车辆详细');
	setTimeout(function(){
    	$.showPreloader()
    },1)
					var key=my.get_key(my.getCookie('token'))
					var cardetails=JSON.parse(sessionStorage.rentalCalDetails)
      				$('<div class="swiper-slide"><img  src="'+config.url_car+cardetails.models_logo+'">').appendTo('.swiper-wrapper')
					$('#cp').text(cardetails.usercar_nickname)
					$('#dd').text(sessionStorage.car_place_name)
					$('#clxh').text(cardetails.brand_chinese_name+' '+cardetails.cars_name)
					$('#qcsj').text(sessionStorage.rangTimeStart+':00')
					$('#hcsj').text(sessionStorage.rangTimeEnd+':00')
					$('#festival_price').text(config.danwei+cardetails.festival_price)
					$('#week_price').text(config.danwei+cardetails.week_price)
					$('#work_day_price').text(config.danwei+cardetails.work_day_price)
					//获取照片
                    var info_carDetail_img={'cars_id':sessionStorage.carDetails_carid}
    					info_carDetail_img=JSON.stringify(info_carDetail_img)
                        info_carDetail_img=my.cryptoASEencrypt(info_carDetail_img,key)
                        $.ajax({
      					url:api.getcarsinfo,
      					type: 'post',
      					async:true,
      					data:{
      						'api_value':info_carDetail_img
      					},
      					error:function(){
      						    $.hidePreloader()
      							$.toast("请求失败，请刷新重试");
      						},
      					success:function(data){
      						$.hidePreloader()
      						if(data.match("err_code")!=null){
      							switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									    my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						}else{
      							      $('.swiper-wrapper').empty()
      								  data=JSON.parse(data)
                                      data=JSON.parse(my.cryptoASEdencrypt(data.data,key))
      							      for(i=0;i<data['carimg'].length;i++){
      							    	var src='<div class="swiper-slide"><img id="'+data['carimg'][i].image_id+'" src="'+config.url+data['carimg'][i].image_bigurl+'">'
      							    	$(src).prependTo('.swiper-wrapper')
      							      }
      							      var mySwiper = new Swiper('.swiper-container',{
                                                       pagination : '.swiper-pagination',
                                                       paginationElement : 'li',
                                               })
      							}
      					}
      				});
					$('.carDetails_qrxd').click(function(){
						   $.showPreloader()
	                        var info_cd={
      					           usercar_id:cardetails.usercar_id,
      					           car_place:sessionStorage.car_place,
      					           start_time:sessionStorage.rangTimeStart,
      					           end_time:sessionStorage.rangTimeEnd,
      					           cartime_id:cardetails.cartime_id
      				        }
	                        console.log(info_cd)
      				        info_cd=my.cryptoASEencrypt(JSON.stringify(info_cd),key)
      				        $.ajax({
      					       url:api.dateandrent,
      					       type: 'post',
      					       async:true,
      					       data:{'api_value':info_cd},
      					       error:function(){
      					       	   $.hidePreloader()
      					       	   $.toast("提交失败，请重试！");},
      					       success:function(data){
      					       	$.hidePreloader()
      						     if(data.match("err_code")!=null){
      							    switch(JSON.parse(data).err_code)
      								{
      									case 40003:
      									   my.tokenExpire()
      									   break;
      									default:
      									   $.toast(JSON.parse(data).err_msg);
      								}
      						     }else{
      							        data=JSON.parse(data)
      							        sessionStorage.orderDetails=my.cryptoASEdencrypt(data.data,key)
      								    //$.router.loadPage("orderDetails.html");
                                     $.router.load(orderDetailsUrl,true);

      							}
      					    }
      			         })
					})
});